package demo2;

import javax.swing.*;

public class WindowBoxLayout extends JFrame {
    Box boxH;
    Box boxVOne, boxVTwo;
  public WindowBoxLayout(){
      setLayout(new java.awt.FlowLayout());
      init();
      setVisible(true);
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }

void init(){
    this.boxH = Box.createHorizontalBox();
    this.boxVOne = Box.createVerticalBox();
    this.boxVTwo = Box.createVerticalBox();
    this.boxVOne.add(new JLabel("姓名："));
    this.boxVOne.add(new JLabel("职业："));
      this.boxVTwo.add(new JTextField(10));
      this.boxVTwo.add(new JTextField(10));
     this.boxH.add(boxVOne);
     boxH.add(Box.createHorizontalStrut(10));
     boxH.add(boxVTwo);
     add(boxH);

}

}
